home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / iau.arc / ILEAVE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-10-25  |  3.2 KB  |  148 lines

  1. #define MYVERSION "Version x.xx"
  2. #include <stdio.h>
  3. #include <hamdefs.h>
  4.  
  5. extern int terminate();
  6. extern int _cbrkflg;
  7.  
  8. char *options[] = {
  9.     "Read WARNING message",
  10.     "Read \"What is interleave?\"",
  11.     "Read \"Why change interleave?\"",
  12.     "Select the disk drive",
  13.     "Execute interleave adjustment",
  14.     "Exit this program",
  15.     NULL
  16. };
  17.  
  18. int drive_to_use=0x80;
  19. int have_selected=0;
  20. int factor;
  21.  
  22. main(argc,argv)
  23. int argc;
  24. char **argv;
  25. {
  26.     static int colarray[]={39};
  27.     int choice;
  28.     char temp[80];
  29.     
  30.     if(argc==2)
  31.     sscanf(argv[1],"%d",&factor);
  32.  
  33.     if(factor<1 || factor>16 || argc!=2)
  34.     factor=5;
  35.  
  36.     clrscn();
  37.     scrbox(0,0,23,79,2,NORMAL|HILITE);
  38.     center(06,"MEMTEC Corporation");
  39.     center(07,"Salem, NH U.S.A. 03079");
  40.     center(08,"(603) 893-8080");
  41.     center(10,"Interleave Adjust Utility (IAU.EXE)");
  42.     center(12,"(c) 1986 MEMTEC Corp. All Rights Reserved");
  43.     center(13,MYVERSION);
  44.  
  45.     locate(17,5);
  46.     keyboard();    /* press a key */
  47.     
  48.     clrscn();
  49.  
  50.     _cbrkflg=FALSE;
  51.     intrinit(terminate,0x800,0x23);
  52.     
  53.     scrtable(0,0,23,78,3,NORMAL|HILITE,5,7,-1,1,colarray);
  54.  
  55.     atputsa(1,37,"Status",NORMAL|HILITE);
  56.     atputsa(6,15,"Selection",NORMAL|HILITE);
  57.     atputsa(6,54,"Information",NORMAL|HILITE);
  58.     
  59.     type("warning.doc",10,43,20,75);
  60.     
  61.     locate(9,5);
  62.  
  63.     choice=0;clrkey();
  64.     while((choice=getbar(options,choice))!=5) {
  65.     switch(choice) {
  66.         case 0:    type("warning.doc",10,43,20,75);
  67.                 break;
  68.         case 1:    type("ileave.doc",10,43,20,75);
  69.             sprintf(temp,"Interleave selected: %d",factor);
  70.             atputsha(21,42,temp);
  71.                 break;
  72.         case 2:    type("change.doc",10,43,20,75);
  73.                 break;
  74.         case 3:    sel_disk();
  75.                 break;
  76.         case 4:    
  77.             atputsha(17,45,"Started  at ");
  78.             showtime(17,58);
  79.             rfw();
  80.             atputsha(13,45,"Complete at ");
  81.             showtime(13,58);
  82.             choice=5;
  83.                 break;
  84.         case 5:
  85.         default:    break;
  86.     }
  87.     clrblk(1,1,4,77);
  88.     atputsa(1,37,"Status",NORMAL|HILITE);
  89.     center(3,"Complete");
  90.     locate(9,5);
  91.     clrkey();
  92.     }
  93.  
  94.     locate(23,0);
  95.     intrrest(0x23);
  96.     exit(0);
  97. }
  98.  
  99. char *pick_disk[] = {
  100.     "Select the first hard disk drive ",
  101.     "Select the second hard disk drive",
  102.     NULL
  103. };
  104.  
  105. sel_disk()
  106. {
  107.     struct {int ax,bx,cx,dx,si,di,ds,es;}r;
  108.     int count;
  109.     char temp[80];
  110.     
  111.     segread(&r.si);
  112.     r.ax=0x0800;
  113.     r.bx=r.cx=0;
  114.     r.dx=drive_to_use;
  115.     if(1&sysint(0x13,&r,&r)) {
  116.     atputsa(2,25,"Unable to address hard disk(s)",NORMAL|HILITE);
  117.     beep();
  118.     return 1;
  119.     }
  120.     count=r.dx&0x0f;
  121.     
  122.     atputsha(22,42,"Drive selected: ");
  123.     switch(count) {
  124.     case 0:    center(3,"No hard disk drives in your system");
  125.         break;
  126.     case 1:    
  127.             break;
  128.     case 2:
  129.         locate(19,5);
  130.         drive_to_use=0x80+getbar(pick_disk,0);
  131.         clrblk(18,4,22,5+strlen(pick_disk[0]));
  132.         break;
  133.     default:
  134.         clrscn();
  135.         atputsa(5,5,"Congratulations! You have more than two hard",NORMAL|HILITE);
  136.         atputsa(6,5,"disks responding, and that BREAKS this program.",NORMAL|HILITE);
  137.         locate(23,0);
  138.         intrrest(0x23);
  139.         exit(9);
  140.         break;
  141.         
  142.     }
  143.     sprintf(temp,"%02d",drive_to_use-0x80);
  144.     atputsa(22,58,temp,NORMAL|HILITE);
  145.     have_selected=1;
  146. }
  147.     
  148.